

function model_view( domElement )
{
	var scope = this;
	scope.do_update = true;
	
	var container = ( domElement !== undefined ) ? domElement : document;
	var container_cs = document.defaultView.getComputedStyle(container, null);
	
	
	// SCENE
	var scene = new THREE.Scene();

	// CAMERA
	var SCREEN_WIDTH = container.clientWidth;
	var SCREEN_HEIGHT = container.clientHeight;
	var VIEW_ANGLE = 45;
	var ASPECT = SCREEN_WIDTH / SCREEN_HEIGHT;
	var NEAR = 0.1;
	var FAR = 20000;
	var camera = new THREE.PerspectiveCamera( VIEW_ANGLE, ASPECT, NEAR, FAR);
	scene.add(camera);
	camera.position.set(0, 0, 400);
	camera.lookAt(scene.position);


	// RENDERER
	if ( Detector.webgl )
		var renderer = new THREE.WebGLRenderer( {antialias:true} );
	else
		var renderer = new THREE.CanvasRenderer(); 
	renderer.setSize(SCREEN_WIDTH, SCREEN_HEIGHT);
	renderer.setClearColor(container_cs["background-color"], 0);
	container.appendChild( renderer.domElement );


	// LIGHT
	scene.add( new THREE.AmbientLight( 0x999999 ) ); // soft white light
	var pointLight = new THREE.PointLight(0xAAAAAA); // Set the color of the light source (white).
	pointLight.position.set(-500, 500, 400); // Position the light source at (x, y, z).
	scene.add(pointLight); // Add the light source to the scene.

	// EVENTS
	var camera_controls = new THREE.OrbitControls( camera, renderer.domElement );
	var light_controls = new THREE.OrbitControls( pointLight, renderer.domElement );
	
	
	// SCENE
	this.group = new THREE.Object3D();
	scene.add(this.group);
	
	
	var render = function ()
	{
		if(scope.do_update == true)
		{
			requestAnimationFrame(render); // Call the render() function up to 60 times per second (i.e., up to 60 animation frames per second).
		}
		else
		{
			camera_controls.enabled = false;
			light_controls.enabled = false;
		}
		renderer.render(scene, camera); // Each time we change the position of the cube object, we must re-render it.
		camera_controls.update();
		light_controls.update();
	};

	render(); // Start the rendering of the animation frames.
};
